package com.lagou.life;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

import javax.annotation.*;

/**
 * @author zyy
 * @date 2022/6/19 上午10:58
 * @description
 */
public class LifeBean implements BeanNameAware, BeanFactoryAware, ApplicationContextAware, InitializingBean {

	private String status;
	private String message;

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	@Override
	public String toString() {
		return "LifeBean{" +
				"status='" + status + '\'' +
				", message='" + message + '\'' +
				'}';
	}

	@Override
	public void setBeanName(String name) {
		System.out.println("注册我成为bean时定义的Id:"+ name);
	}

	@Override
	public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
		System.out.println("我的BeanFactory为：" + beanFactory);
	}

	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		System.out.println("我的高级容器接口ApplicationContext为:" + applicationContext);
	}


	@Override
	public void afterPropertiesSet() throws Exception {
		System.out.println("afterPropertiesSet.....");
	}

	public void initMethod(){
		System.out.println("init-Method...");
	}

	@PostConstruct
	public void postCoustruct(){
		System.out.println("postCoustruct...");
	}
}
